/**
 * 
 */
package UnitTests;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import RefactoringA1.src.CheckingAccount;
import RefactoringA1.src.DebitCard;

/**
 * @author Thomas
 *
 */
public class DebitCardTest {

	
	/**
	 * A CheckingAccount for testing.
	 */
	CheckingAccount ca2;

	/**
	 * A DebitCard for testing.
	 */
	DebitCard dc1;
	
	/**
	 * A DebitCard for testing.
	 */
	DebitCard dc2;
	
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		ca2= new CheckingAccount("Bobby", "Maple", "98500", "Anytown", "usa", 5000);
		dc1 = new DebitCard("Bobby", "Maple", "98500", "Anytown", "usa");
		dc2 = new DebitCard("Bobby", "Maple", "98500", "Anytown", "usa", 50000.00, ca2);
	}
	

	/**
	 * Test method for {@link RefactoringA1.src.DebitCard#DebitCard(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
	 */
	@Test
	public void testDebitCardStringStringStringStringString() {
		Assert.assertTrue(dc1 instanceof DebitCard);
	}

	/**
	 * Test method for {@link RefactoringA1.src.DebitCard#DebitCard(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, double, RefactoringA1.src.CheckingAccount)}.
	 */
	@Test
	public void testDebitCardStringStringStringStringStringDoubleCheckingAccount() {
		Assert.assertTrue(dc2 instanceof DebitCard);
	}

	/**
	 * Test method for {@link RefactoringA1.src.DebitCard#pay(double)}.
	 */
	@Test
	public void testPay() {
		Assert.assertFalse(dc2.pay(10.00));
		Assert.assertTrue(dc2.pay(100000.00));
	}

	/**
	 * Test method for {@link java.lang.Object#Object()}.
	 */
	@Test
	public void testObject() {
		Assert.assertTrue(dc1 instanceof DebitCard);
		Assert.assertTrue(dc2 instanceof DebitCard);
	}

	/**
	 * Test method for {@link java.lang.Object#getClass()}.
	 */
	@Test
	public void testGetClass() {
		Assert.assertTrue(dc1.getClass().getSimpleName().equals("DebitCard"));
	}

	/**
	 * Test method for {@link java.lang.Object#equals(java.lang.Object)}.
	 */
	@Test
	public void testEquals() {
		Assert.assertEquals(dc1, dc1);
		Assert.assertFalse(dc1.equals(dc2));
	}
}